#ifndef _IN_SDK_RING_BUFFER_H_
#define _IN_SDK_RING_BUFFER_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include "InComDataTypeDef.h"

#define DEF_SDK_AV_AUDIO_BUF_NUM              20
#define DEF_SDK_AV_AUDIO_BUF_SIZE             (20 * 640)
#define DEF_SDK_AV_VIDEO_BUF_NUM              15
#define DEF_SDK_AV_VIDEO_BUF_SIZE             (5 * (400 * 1024))

typedef struct
{
    Com_s32 frame_len;
    Com_s32 frame_type;
    Com_ps8 frame_buf;
}StSdkRingBufFrame,*pStSdkRingBufFrame;

typedef struct
{
    Com_ps8 head_buff;
    Com_s16 pos_w;
    Com_s16 pos_r;
    Com_s32 write_num;
    Com_s32 num_elements;
    Com_s32 malloc_size;
    Com_s32 use_len;
    pStSdkRingBufFrame frame_info;
    pthread_mutex_t mutex;
}StSdkRingBufInfo,*pStSdkRingBufInfo;

typedef	struct
{
    StSdkRingBufInfo mic_ring_buffer;
    StSdkRingBufInfo spk_ring_buffer;
    StSdkRingBufInfo video_ring_buffer;
    Com_s32 (*get_one_frame_from_ring_buffer)(pStSdkRingBufInfo ring_buffer, pStSdkRingBufFrame frame);
    /* ret is -3,need key frame */
    Com_s32 (*push_video_frame_to_ring_buffer)(pStSdkRingBufInfo ring_buffer, pStSdkRingBufFrame frame);
    Com_s32 (*push_audio_frame_to_ring_buffer)(pStSdkRingBufInfo ring_buffer, pStSdkRingBufFrame frame);
}StSdkRingBufInfoProducer,*pStSdkRingBufInfoProducer;

Com_s32 Ext_InSdk_RingBuf_Create_AV_Info(pStSdkRingBufInfoProducer producer);
Com_s32 Ext_InSdk_RingBuf_Distroy_AV_Info(pStSdkRingBufInfoProducer producer);

#ifdef __cplusplus
}
#endif

#endif
